import http from '@/plugins/axios'

// 列表
export function getCustomerConsultationRecord(data) {
  return http({
    method: 'POST',
    url: '/fa/hotels/page',
    data: data
  })
}

// 获取城市下拉接口
export function getHotelsCitys() {
  return http({
    method: 'POST',
    url: '/fa/hotels/cityList',
    data: { name: '' }
  })
}

// 详情
export function getCustomerConsultationRecordDetail(id) {
  return http({
    method: 'POST',
    url: '/fa/hotels/info',
    data: { id }
  })
}

// 新增
export function addCustomerConsultationRecord(data) {
  return http({
    method: 'POST',
    url: '/fa/hotels/save',
    data
  })
}

// 编辑
export function saveCustomerConsultationRecord(data) {
  const obj = {}
  ;['id', 'hotelsId', 'title', 'hotelsCityId', 'address', 'tel', 'openingtime', 'decorationtime', 'roomsNum', 'score', 'scoreNum', 'starRated', 'status', 'cooperationLevel', 'roomNameJson']
    .forEach(key => {
      obj[key] = data[key]
    })
  return http({
    method: 'POST',
    url: '/fa/hotels/update',
    data: obj
  })
}

// 导出
export function exportCustomerConsultationRecord(data) {
  return http({
    rowResponse: true,
    method: 'POST',
    url: '/fa/hotels/export',
    responseType: 'blob',
    data
  })
}

// 删除
export function removeCustomerConsultationRecord(ids) {
  return http({
    method: 'POST',
    url: '/fa/hotels/delete',
    data: ids
  })
}

// 获取员工列表
export function getUserList() {
  return http({
    method: "POST",
    url: '/sys/user/list',
    data: {
      page: { index: 1, size: 9999999999 },
      condition: { keyword: '' }
    }
  }).then(res => {
    return res.list
  })
}

// 新增记录
export function addHotelRecord(data) {
  return http({
    method: 'POST',
    url: '/fa/hotels/saveRecord',
    data: data
  })
}

export function getHotelRecord(id) {
  return http({
    method: 'POST',
    url: '/fa/hotels/recordList',
    data: { hoId: id }
  })
}
